(function ({form,table,layer,laydate,url,contentType,ok,AjaxFn,vpositionid,vpositionname}) {


    form.on("submit(formDemo)",function ({field}) {
        field.vpositionname = field.vpositionname.trim()
        let {code,msg} = AjaxFn(url+"updataPositionVpositionname",JSON.stringify(field),{});
        code==200?ok(msg,1): layer.msg(msg,{icon: 5});
        return false;
    })


})({
    form: layui.form,
    table: layui.table,
    layer: layui.layer,
    laydate:layui.laydate,
    url: "/evaluation/positionAndTeam/",
    vpositionid:$("#vpositionid").val(),
    vpositionname:$("#vpositionname").val(),
    contentType: 'application/json;charset=utf-8',
    ok:function(msg,icon){
        parent.layui.layer.confirm(msg, {
            id: "ok",
            icon: icon,
            anim: 4,
            title: '提示',
            btn: ['确定'],
            skin: 'demo-class-updata',
            closeBtn:false,
            success: function (layero) {
                var btn = layero[0].getElementsByClassName('layui-layer-btn')[0].getElementsByTagName('A')[0];
                btn.href = 'javascript:void(0)';
                btn.focus();
            },
            yes: function(index, layero){
                var index2 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.closeAll(); //再执行关闭
            },
            end:function () {
               /* var index2 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.closeAll(); //再执行关闭*/
            }
        });
    },
    AjaxFn:function (url,data,resource) {
        $.ajax({
            url,
            contentType:'application/json;charset=utf-8',
            type:'post',
            async:false,
            data,
            success:function(res) {
                let {msg='',code=''} =res;
                msg=='' && code==''? top.location.reload() : "";
                resource = res;
            }
        });
        return resource;
    },
})